package me.zhengjie.stu.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.stu.domain.Stu;
import me.zhengjie.stu.service.StuService;
import me.zhengjie.stu.service.dto.StuDto;
import me.zhengjie.stu.service.dto.StuQueryCriteria;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequiredArgsConstructor
@Api(tags = "学生登录管理")
@RequestMapping("/api/login")
public class loginController {

    private final StuService stuService;

    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('stu:list')")
    public void download(HttpServletResponse response, StuQueryCriteria criteria) throws IOException {
        stuService.download(stuService.queryAll(criteria), response);
    }




}
